﻿@{
    System.Web.Profile.ProfileBase profile = System.Web.Profile.ProfileBase.Create(User.Identity.Name);
    string realname = User.Identity.Name;
    if (profile["RealName"] != null)
    {
        realname = profile["RealName"].ToString();
    }
    //get realname from expertjudge table instead of from profile data
    if(User.IsInRole("评委"))
    {
        using (AuditModel.AuditDBEntities db = new AuditModel.AuditDBEntities())
        {
            AuditModel.ExpertJudge ej = db.ExpertJudges.SingleOrDefault(e => e.SerialNumber == User.Identity.Name);
            realname = ej.RealName;
        }
        
    }
}

@if(Request.IsAuthenticated) {
    <text>欢迎 <strong>@realname</strong>!
    [ @Html.ActionLink(AuditResources.Account.LogOff, "LogOff", "Account") ]</text>
}
else {
    @:[ @Html.ActionLink(AuditResources.Account.LogOn, "LogOn", "Account") ]
}
